package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolKeyVO;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolQueryVO;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolSearchVO;
import com.jwsoft.manager.common.vo.eduAddressSchool.EduAddressSchoolVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolAudit.EduAddressSchoolAuditQueryVO;
import com.jwsoft.manager.common.vo.eduAddressSchoolAudit.EduAddressSchoolAuditVO;
import com.jwsoft.manager.core.integration.EduAddressSchoolIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 地址学校关联表网关
 *
 * @author wangtao
 * @since 2022-12-02
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "地址学校关联表", description = "地址学校关联表")
public class EduAddressSchoolController {

    @Autowired
    public EduAddressSchoolIntegration eduAddressSchoolIntegration;

    @Operation(summary = "地址学校关联表分页查询",description = "地址学校关联表分页查询")
    @PostMapping(value = "/eduAddressSchool0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolVO>> getList(@RequestBody @Validated EduAddressSchoolQueryVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.getList(vo));
    }

    @Operation(summary = "地址学校关联表根据主键查询详情", description = "地址学校关联表根据主键查询详情")
    @PostMapping(value = "/eduAddressSchool0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolVO> getById(@RequestBody @Validated EduAddressSchoolKeyVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.getById(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表新增", description = "地址学校关联表新增")
    @PostMapping(value = "/eduAddressSchool0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduAddressSchoolVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.add(vo));
    }
    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表新增批量", description = "地址学校关联表新增批量")
    @PostMapping(value = "/eduAddressSchool0011", produces = "application/json;charset=UTF-8")
    public AppResponse addBatch(@RequestBody @Validated(value = {Validators.Add.class}) EduAddressSchoolVO vo) {
        eduAddressSchoolIntegration.addBatch(vo);
        return AppResponse.successMsg("操作成功！");
    }
    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表修改", description = "地址学校关联表修改")
    @PostMapping(value = "/eduAddressSchool0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduAddressSchoolVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduAddressSchoolVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表删除", description = "地址学校关联表删除")
    @PostMapping(value = "/eduAddressSchool0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduAddressSchoolKeyVO vo) {
        eduAddressSchoolIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "学校地址预警取消关联", description = "学校地址预警取消关联")
    @PostMapping(value = "/eduAddressSchool0026", produces = "application/json;charset=UTF-8")
    public AppResponse delByErrors(@RequestBody @Validated EduAddressSchoolKeyVO vo) {
        eduAddressSchoolIntegration.delByErrors(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Operation(summary = "查询待审核信息", description = "查询待审核信息")
    @PostMapping(value = "/eduAddressSchool0007", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolAuditVO>> queryAddressSchoolAudit(@RequestBody @Validated EduAddressSchoolAuditQueryVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.queryAddressSchoolAudit(vo));
    }

    @Idempotent(expire = "PT2S")
    @Operation(summary = "地址审核", description = "地址审核")
    @PostMapping(value = "/eduAddressSchool0008", produces = "application/json;charset=UTF-8")
    public AppResponse doAudit(@RequestBody @Validated EduAddressSchoolAuditVO vo) {
        eduAddressSchoolIntegration.addressAudit(vo);
        return AppResponse.success();
    }

    @Operation(summary = "关联地址信息查询", description = "关联地址信息查询")
    @PostMapping(value = "/eduAddressSchool0009", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolVO>> queryAddress(@RequestBody @Validated EduAddressSchoolSearchVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.queryAddress(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表删除批量", description = "地址学校关联表删除批量")
    @PostMapping(value = "/eduAddressSchool0010", produces = "application/json;charset=UTF-8")
    public AppResponse delBatch(@RequestBody @Validated EduAddressSchoolKeyVO vo) {
        eduAddressSchoolIntegration.delBatch(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire = "PT2S")
    @Operation(summary = "地址批量审核", description = "地址批量审核")
    @PostMapping(value = "/eduAddressSchool0012", produces = "application/json;charset=UTF-8")
    public AppResponse doAuditBatch(@RequestBody @Validated EduAddressSchoolAuditVO vo) {
        eduAddressSchoolIntegration.doAuditBatch(vo);
        return AppResponse.success();
    }


    @Operation(summary = "学校本年度地址库查询",description = "学校本年度地址库查询")
    @PostMapping(value = "/eduAddressSchool0013", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolVO>> querySchoolAddressByNowYear(@RequestBody @Validated EduAddressSchoolQueryVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.querySchoolAddressByNowYear(vo));
    }


    @Operation(summary = "本年全市未关联地址查询", description = "本年全市未关联地址查询")
    @PostMapping(value = "/eduAddressSchool0014", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolVO>> nowYearNoRelationAddress(@RequestBody @Validated EduAddressSchoolSearchVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.nowYearNoRelationAddress(vo));
    }

    @Operation(summary = "查询本年审核不通过信息", description = "查询本年审核不通过信息")
    @PostMapping(value = "/eduAddressSchool0015", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduAddressSchoolAuditVO>> queryNoPassAuditAddressSchoolAudit(@RequestBody @Validated EduAddressSchoolAuditQueryVO vo) {
        return AppResponse.successData(eduAddressSchoolIntegration.queryNoPassAuditAddressSchoolAudit(vo));
    }


    @Idempotent(expire = "PT2S")
    @Operation(summary = "审核失败地址退回审核通过", description = "审核失败地址退回审核通过")
    @PostMapping(value = "/eduAddressSchool0016", produces = "application/json;charset=UTF-8")
    public AppResponse noPassAddressAudit(@RequestBody @Validated EduAddressSchoolAuditVO vo) {
        eduAddressSchoolIntegration.noPassAddressAudit(vo);
        return AppResponse.success();
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表批量取消关联", description = "地址学校关联表批量取消关联")
    @PostMapping(value = "/eduAddressSchool0017", produces = "application/json;charset=UTF-8")
    public AppResponse batchDelete(@RequestBody @Validated EduAddressSchoolKeyVO vo) {
        eduAddressSchoolIntegration.batchDelete(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "地址学校关联表批量修改", description = "地址学校关联表批量修改")
    @PostMapping(value = "/eduAddressSchool0018", produces = "application/json;charset=UTF-8")
    public AppResponse batchUpdate(@RequestBody @Validated EduAddressSchoolKeyVO vo) {
        eduAddressSchoolIntegration.batchUpdate(vo);
        return AppResponse.successMsg("批量修改成功！");
    }
}
